<template>
  <div class="wh-100 d-flex">
    <historicDetail class="wh-100" v-if="showHistory" @close="showHistory = false" :idCard="idCard"
                    :type="historyType"/>

    <div class="wh-100 d-flex" v-else>
      <div :class="showRight ? 'w-78' : 'w-100'" class="h-100 card" style="background-color: white">
        <div class="mt-8 mb-8  d-flex-between-center">
          <div class=" h-100 d-flex-align-center">
            <!--              <Button v-has="'add'" @click="add" type="primary" icon="md-add">添加</Button>-->
            <Button v-has="'delete'" @click="delAll" icon="md-trash">批量删除</Button>
            <Button @click="getDataList" icon="md-refresh">刷新</Button>
            <!--              <Button type="dashed" @click="openSearch=!openSearch">{{ openSearch ? "关闭搜索" : "开启搜索" }}</Button>-->
            <Button type="dashed" @click="openTip = !openTip">{{ openTip ? '关闭提示' : '开启提示' }}
            </Button>
            <Button v-has="'input'" type="primary" icon="ios-cloud-upload-outline" @click="importFormView = true">
              导入毕业去向登记
            </Button>
            <Button v-if="resource === '0'" @click="huifu" class="mr-auto">数据恢复</Button>
            <Button v-if="resource === '0'" @click="buquan" class="mr-auto">届别数据补全(耗时)</Button>
            <Modal v-model="importFormView" title="导入毕业去向登记" v-loading="modelLoading">
              <Form :model="importForm" :label-width="80" class="FormStyle">
                <!--                                    <FormItem label="导入方式: ">-->
                <!--                                        <RadioGroup v-model="importForm.importMode">-->
                <!--                                            <Row>-->
                <!--                                                <Radio label="1">增加记录(只增加新的记录,已存在的记录不变)</Radio>-->
                <!--                                            </Row>-->
                <!--                                            <Row>-->
                <!--                                                <Radio label="2">覆盖记录(只对存在的记录进行更新)</Radio>-->
                <!--                                            </Row>-->
                <!--                                            <Row>-->
                <!--                                                <Radio label="3">增加+覆盖记录</Radio>-->
                <!--                                            </Row>-->
                <!--                                        </RadioGroup>-->
                <!--                                    </FormItem>-->
                <FormItem label="文件: ">
                  <!--                                        <Upload accept=".xls, .xlsx,.dbf,.zip,.rar" :before-upload="handleUpload">-->
                  <!--                                            <Button icon="ios-cloud-upload-outline">点击上传</Button>-->
                  <!--                                        </Upload>-->
                  <Upload accept=".xlsx" :before-upload="handleUpload">
                    <Button icon="ios-cloud-upload-outline">点击上传</Button>
                  </Upload>
                  <div v-if="importForm.file !== null">
                    {{ importForm.file.name }}
                  </div>
                  <div>注: 导入毕业去向登记信息时, 请先导入生源信息, 否则无法导入去向信息。</div>
                  <div>说明：请依据模板数据格式导入，文件支持.xlsx,.xls,dbf,以及压缩包导入</div>
                </FormItem>
              </Form>
              <div slot="footer">
                <Button @click="importFormcCncel">取消</Button>
                <Button type="primary" :loading="importing" @click="importFormOk">开始上传</Button>
              </div>
            </Modal>
            <Button v-has="'other'" @click="downloadTemple" type="info">下载导入模板</Button>
            <Button v-has="'upload'" v-loading="exportingSelect" @click="dropExportSelect">导出所选数据</Button>
            <Button v-has="'enable'" v-loading="exportingAll" @click="dropExportAll">导出全部数据</Button>
            <Button v-has="'add1'" v-loading="exportingSearch" @click="dropExportSearch" class="mr-auto">下载当前查询数据
            </Button>

          </div>
          <Button class="mr-8" :icon="showRight?`ios-arrow-forward`:`ios-arrow-back`"
                  @click.native="clickShowRight"
                  type="primary">
          </Button>
        </div>
        <div v-show="openTip">
          <Alert show-icon>
            已选择 <span class="select-count">{{ selectList.length }}</span> 项
            <a class="select-clear" @click="clearSelectAll">清空</a>
          </Alert>
        </div>
        <div v-ref-height="refHeight" class="h-80 w-100 calc-px-height">
          <!--                  双击左键事件      @on-row-dblclick="sjclaib"-->
          <div v-if="loading" class="wh-100 d-flex-around-center">
            <Spin></Spin>
          </div>
          <div v-else class="wh-100">
            <el-table
                :v-loading="listloading"
                border
                :columns="columns"
                :data="data"
                ref="tableA"
                sortable="custom"
                empty-text="暂无数据"
                :height="refHeight.value"
                @sort-change="changeSort"
                @selection-change="changeSelect"
            >
              <!--<template slot-scope="{ row, index }" slot="status">
                <div class="wh-100">
                  <span v-if="row.status == 1">草稿</span>
                  <span v-if="row.status == 3">待审核</span>
                  <span v-if="row.status == 6">审核通过</span>
                  <span v-if="row.status == 5">学生撤回</span>
                  <span v-if="row.status == 10">驳回</span>
                  <span v-if="row.status == 0 || row.status == 4 || row.status == 9">待填报</span>
                  <span v-if="row.status == -1">作废</span>
                </div>
              </template>-->
              <el-table-column type="selection" width="60" align="center"></el-table-column>
              <el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
              <el-table-column v-for="column in columns" :key="column.key" :prop="column.key" :label="column.title" :sortable="column.sortable" :width="column.width" :min-width="column.minWidth" :fixed="column.fixed">
                <template slot-scope="scope">
                  <div v-if="column.key == 'status'">
                    <div class="wh-100">
                      <span v-if="scope.row.status == 1">草稿</span>
                      <span v-if="scope.row.status == 3">待审核</span>
                      <span v-if="scope.row.status == 6">审核通过</span>
                      <span v-if="scope.row.status == 5">学生撤回</span>
                      <span v-if="scope.row.status == 10">驳回</span>
                      <span v-if="scope.row.status == 0 || scope.row.status == 4 || scope.row.status == 9">待填报</span>
                      <span v-if="scope.row.status == -1">作废</span>
                    </div>
                  </div>
                  <div v-else-if="column.key == 'importFlag'">
                    <span v-if="scope.row.importFlag == 0">学生填报</span>
                    <span v-else-if="scope.row.importFlag == 1">学校导入</span>
                    <span v-else-if="scope.row.importFlag == 2">学院修改</span>
                    <span v-else-if="scope.row.importFlag == 3">学校修改</span>
                  </div>
                  <div v-else-if="column.key == 'pyfsCode'">
                    <div>{{ pyfsCodeValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'onetype'">
                    <div>{{ oneTypeValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'type'">
                    <div>{{ jyTypeValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'dwxz'">
                    <div>{{ dwxzValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'dwhy'">
                    <div>{{ dwhyValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'dwszd'">
                    <div>{{ dwszdValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'gzzwlb'">
                    <div>{{ gzzwlbValue(scope.row[column.key]) }}</div>
                  </div>
                  <div v-else-if="column.key == 'action'">
                    <div>
                      <a style="display: 'inline-block'" @click="sjclaib(scope.row)">编辑</a>
                      <Divider type="vertical" />
                      <a style="display: 'inline-block'" @click="history(scope.row)">历史</a>
                    </div>
                  </div>
                  <div v-else>{{ scope.row[column.key] }}</div>
                </template>
              </el-table-column>
            </el-table>
            <!-- <div v-else class="wh-100">
              <NoData class="wh-100"></NoData>
            </div> -->
          </div>
        </div>
        <div class="w-100 h-5 d-flex-around-center">
          <Page
              :current="searchForm.pageNumber"
              :total="total"
              :page-size="searchForm.pageSize"
              @on-change="changePage"
              @on-page-size-change="changePageSize"
              :page-size-opts="[10, 20, 50, 100, 200]"
              size="small"
              show-total
              show-elevator
              show-sizer
          ></Page>
        </div>
      </div>
      <div v-show="showRight" class="w_22-12 rightStyle h-100  ml-12 card overflow-auto">
        <div v-show="!modalVisible" @keydown.enter.native="handleSearch" class="wh-100 pl-8 pr-8">
          <div class=" pt-12 fs-16  fw-6 ">
            查询区
          </div>
          <div ><!-- class="mt-52 "-->
            <Form ref="searchForm" :model="searchForm"  :label-width="quryLabelWidth" class="marginForm"
                  label-position="right">
              <FormItem v-if='resource === "1"' label="高校代码" prop="gxcode">
                <Input type="text" v-model="searchForm.gxcode" placeholder="请输入高校代码" clearable />
              </FormItem>
              <FormItem v-if='resource === "1"' label="高校名称" prop="gxmc">
                <Input type="text" v-model="searchForm.gxmc" placeholder="请输入高校名称" clearable />
              </FormItem>
              <!-- <FormItem v-if='resource === "2"' label="院系名称" prop="xsh">
                <Input type="text" v-model="searchForm.xsh" placeholder="请输入院系名称" clearable
                       />
              </FormItem> -->
              <FormItem label="姓名" prop="xm">
                <Input type="text" v-model="searchForm.xm" placeholder="请输入姓名" clearable />
              </FormItem>
              <FormItem label="所在班级" prop="xm">
                <Input type="text" v-model="searchForm.szbj" placeholder="请输入所在班级" clearable/>
              </FormItem>
              <FormItem label="考生号" prop="ksh">
                <Input type="text" v-model="searchForm.ksh" placeholder="请输入考生号" clearable />
              </FormItem>
              <FormItem label="学号" prop="xh">
                <Input type="text" v-model="searchForm.xh" placeholder="请输入学号" clearable />
              </FormItem>
              <FormItem label="身份证号" prop="sfzh">
                <Input type="text" v-model="searchForm.sfzh" placeholder="请输入身份证号" clearable />
              </FormItem>
              <FormItem label="学历" prop="gzzwlb">
                <Select v-model="searchForm.xlccs"  >
                  <Option  :value="0"  >专科</Option>
                  <Option  :value="1"  >本科</Option>
                  <Option  :value="2"  >研究生</Option>
                </Select>
              </FormItem>
              <FormItem label="单位类别" prop="gzzwlb">
                  <Select v-model="searchForm.gzzwlb" clearable filterable >
                      <Option v-for="(item,index) in gzzwlbList" :value="item.value" :key="index">{{ item.title }}</Option>
                  </Select>
              </FormItem>
              <FormItem label="单位名称" prop="dwmc">
                <Input type="text" v-model="searchForm.dwmc" placeholder="请输入单位名称" clearable />
              </FormItem>
              <FormItem label="留学院校中文名称" prop="chineseName">
                  <Select v-model="searchForm.jwxxzwmc" clearable filterable >
                      <Option v-for="(item,index) in gwSchoolCodeList" :value="item.chineseName" :key="index">
                          {{ item.chineseName.toString().substring(0, 18) }}
                      </Option>
                  </Select>
              </FormItem>
              <FormItem label="专业" prop="zy">
                <Input type="text" v-model="searchForm.zy" placeholder="请输入单位名称" clearable />
              </FormItem>
              <FormItem label="单位行业" prop="dwhy">
                  <Select v-model="searchForm.dwhy" clearable filterable >
                      <Option v-for="(item,index) in dwhyList" :value="item.value" :key="index">{{ item.title }}</Option>
                  </Select>
              </FormItem>
              <FormItem v-if="resource === '0' || resource === '1' || resource === '2'" label="院系名称"
                        prop="yxmc">
                <Input type="text" v-model="searchForm.yxmc" placeholder="请输入院系名称" clearable />
              </FormItem>
              <FormItem label="培养方式" prop="pyfsCode">
                  <Select v-model="searchForm.pyfsCode" clearable filterable >
                      <Option v-for="(item,index) in pyfsList" :value="item.value" :key="index">{{ item.title }}</Option>
                  </Select>
              </FormItem>
              <FormItem label="就业状况" prop="onetype">
                <Select @on-change="chooseOneType" v-model="searchForm.onetype" clearable filterable >
                    <Option v-for="(item,index) in oneTypeDicts" :value="item.value" :key="index">{{ item.title }}</Option>
                </Select>
              </FormItem>
              <FormItem v-if="isShowType" label="就业类别" prop="type">
                <el-cascader v-model="searchForm.type" clearable
                             :options="bysqxDicts"
                             :props="props" filterable>
                  <template slot-scope="{ node, data }">
                    <span>{{ data.title }}</span>
                  </template>
                </el-cascader>
              </FormItem>
              <FormItem label="去向登记状态" prop="status">
                  <Select v-model="searchForm.status" clearable filterable >
                  <Option :value="1">草稿</Option>
                  <Option :value="3">待学校审核</Option>
                  <Option :value="4">待院系审核</Option>
                  <Option :value="6">审核通过</Option>
                  <Option :value="5">学生撤回</Option>
                  <Option :value="10">驳回</Option>
                  <Option :value="0">待填报</Option>
                  <!--                                    <Option value="-1">作废</Option>-->
                </Select>
              </FormItem>
              <FormItem label="数据来源" prop="importFlag">
                  <Select v-model="searchForm.importFlag" clearable filterable >
                  <Option value="0">学生填报</Option>
                  <Option value="1">学校导入</Option>
                  <Option value="2">学院修改</Option>
                  <Option value="3">学校修改</Option>
                </Select>
              </FormItem>
                <FormItem class="br box-key">
                <Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
                <Button @click="handleReset">重置</Button>
              </FormItem>
            </Form>
          </div>
        </div>
        <div v-show="modalVisible" class="wh-100 pl-8 pr-8">
          <div class=" pt-12 fs-16  fw-6 ">
            {{ modalTitle }}
          </div>
          <div class="mt-52">
            <Form ref="form" :model="form" :rules="formValidate" :label-width="100" label-position="left"
                  class="marginForm">
              <div v-if="modalType == '1'">
                <p class="drawer-title">个人信息</p>
                <FormItem label="姓名" prop="xm">
                  <Input v-model="form.xm" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="考生号" prop="ksh">
                  <Input v-model="form.ksh" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="所在班级" prop="szbj">
                  <Input v-model="form.szbj" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="学号" prop="xh">
                  <Input v-model="form.xh" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="身份证号" prop="sfzh">
                  <Input v-model="form.sfzh" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="院校名称" prop="yxmc">
                  <Input v-model="form.yxmc" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="院系名称" prop="xsh">
                  <Input v-model="form.xsh" maxlength="70" readonly/>
                </FormItem>
                <FormItem label="培养方式" prop="pyfs">
                  <Input v-model="form.pyfs" maxlength="70" readonly/>
                </FormItem>

                <!--              <FormItem label="学历层次" prop="xlccmc">-->
                <!--                <Input  v-model="form.xlccmc" clearable maxlength="70" readonly/>-->
                <!--              </FormItem>-->
                <Divider/>
              </div>
              <p class="drawer-title">毕业去向信息</p>
              <div>
                <FormItem prop="onetype"
                          :rules="{ required: true, message: '不能为空', trigger: 'change' }">
                  <div class=" " slot="label" style="position: relative;cursor: pointer">
                    <div>就业状况</div>
                  </div>
                  <el-select no-match-text="暂无数据" :disabled="true" class="w-100"
                             no-data-text="暂无数据"
                             v-model="form.onetype" @change="chooseOneType" filterable clearable
                             placeholder="请选择">
                    <el-option v-for="item in oneTypeDicts" :key="item.value" :label="item.title"
                               :value="item.value"></el-option>
                  </el-select>
                </FormItem>
                <FormItem prop="type"
                          :rules="{ required: true, message: '不能为空', trigger: 'change', validator: validateEmploymentCategory }">
                  <div class="" slot="label" style="position: relative">
                    <div>就业类别</div>
                  </div>
                  <el-cascader
                      :show-all-levels="false"
                      v-model="form.type"
                      :disabled="true"
                      size="small"
                      :options="bysqxDicts"
                      :props="props"
                      clearable
                      transfer
                      class="w-100"
                      filterable
                      @change="handleChange"
                      empty="'暂无数据'"
                  >
                    <template slot-scope="{ node, data }">
                      <span>{{ data.title }}</span>
                    </template>
                  </el-cascader>
                </FormItem>
              </div>
              <FormItem v-if="formIsShow.dwmc" :label="nameOfOrganizationLabel" prop="dwmc"
                        :rules="[{ required: formRequired.dwmc, message: '不能为空', trigger: 'blur' }]">
                <el-input maxlength="100" v-model="form.dwmc" clearable
                          :placeholder="formPlaceholder.dwmc"></el-input>
              </FormItem>
              <FormItem v-if="formIsShow.major" prop="major" label="升学专业"
                        :rules="[{ required: formRequired.major, message: '该项必填', trigger: 'blur' }]">
                <Input v-model="form.major" placeholder="请输入所学专业"/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.tyshxycode"
                  label="组织机构代码/工商营业执照"
                  prop="tyshxycode"
                  :rules="[{ required: formRequired.tyshxycode, trigger: 'blur', validator: validateOrganizingInstitutionBarCode }]"
              >
                <Input maxlength="18" v-model="form.tyshxycode" clearable/>
              </FormItem>
              <!--              加自定义校验-->
              <FormItem v-if="formIsShow.dwxz" prop="dwxz"
                        :rules="{ required: formRequired.dwxz, message: '不能为空', trigger: 'change' }">
                <div class="itemLabel" slot="label" @click="clickSexCode('dwxz')"
                     style="position: relative">
                  <div>单位性质</div>
                </div>
                <FormItem class="small" prop="dwxz" filterable clearable
                          @on-create="keyUpSearch($event, 'dwxz')">
                  <Select v-model="form.dwxz" clearable transfer filterable>
                    <Option v-for="(item,index) in unitNatureDicts" :value="item.value" :key="index">{{ item.title }}
                    </Option>
                  </Select>
                </FormItem>
              </FormItem>
              <FormItem v-if="formIsShow.dwhy" prop="dwhy"
                        :rules="[{ required: formRequired.dwhy, message: '不能为空', trigger: 'change' }]">
                <div class="itemLabel" slot="label" @click="clickSexCode('dwhy')"
                     style="position: relative">
                  <div>单位行业</div>
                </div>
                <Select v-model="form.dwhy" filterable clearable
                        @on-create="keyUpSearch($event, 'dwhy')">
                  <Option v-for="(item,index) in unitIndustryDicts" :value="item.value" :key="index">{{ item.title }}
                  </Option>
                </Select>
              </FormItem>
              <FormItem
                  v-if="formIsShow.dwszd"
                  :label="locationOfTheUnitLabel"
                  prop="dwszd"
                  :rules="[{ required: formRequired.dwszd, trigger: 'change', validator: validatelocationOfTheUnit }]"
              >
                <el-cascader @change="changeDwszd" class="w-100"
                             :props="provincesAndMunicipalitiesProps"
                             v-model="form.dwszd" :options="areaCodeList"></el-cascader>
              </FormItem>
              <FormItem v-if="formIsShow.gzzwlb" prop="gzzwlb"
                        :rules="[{ required: formRequired.gzzwlb, message: '不能为空', trigger: 'change' }]">
                <div class="itemLabel" slot="label" @click="clickSexCode('gzzwlb')"
                     style="position: relative">
                  <div class="itemLabel">工作职位类别</div>
                </div>
                <Select v-model="form.gzzwlb" filterable clearable
                        @on-create="keyUpSearch($event, 'gzzwlb')">
                  <Option v-for="(item,index) in jobPositionCategoryDicts" :value="item.value" :key="index">{{
                      item.title
                    }}
                  </Option>
                </Select>
              </FormItem>

              <FormItem v-if="formIsShow.dwlxr" label="单位联系人" prop="dwlxr"
                        :rules="[{ required: formRequired.dwlxr, message: '不能为空', trigger: 'blur' }]">
                <Input maxlength="100" v-model="form.dwlxr" clearable/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.lxrdw"
                  label="联系人电话"
                  prop="lxrdw"
                  :rules="[
                                    { required: formRequired.lxrdw, message: '该项必填', trigger: 'blur' },
                                    { pattern: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/, message: '请输入正确的联系人电话,如021-88888888' }
                                ]"
              >
                <Input maxlength="100" v-model="form.lxrdw" clearable/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.dwdh"
                  label="联系人手机"
                  prop="dwdh"
                  :rules="[{ pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '请输入正确的手机号，如13988888888' }]"
              >
                <Input maxlength="100" v-model="form.dwdh" clearable/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.lxremail"
                  label="联系人Email"
                  prop="lxremail"
                  :rules="[{ pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, message: '请输入正确的Email地址' }]"
              >
                <Input maxlength="100" v-model="form.lxremail" clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.lxrfax" label="联系人传真" prop="lxrfax">
                <Input maxlength="100" v-model="form.lxrfax" clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.dwdz" label="单位地址" prop="dwdz">
                <Input maxlength="100" v-model="form.dwdz" clearable/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.dwyb"
                  label="单位邮编"
                  prop="dwyb"
                  :rules="[
                                    { required: formRequired.dwyb, message: '该项必填', trigger: 'blur' },
                                    { pattern: /[1-9]\d{5}(?!\d)/, message: '请输入正确的邮政编码' }
                                ]"
              >
                <Input maxlength="6" v-model="form.dwyb" clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.zzhxz" label="月薪（税前）" prop="zzhxz"
                        :rules="[{ pattern: /^(0|[1-9][0-9]*)$/, message: '请输入非负数字' }]">
                <Input maxlength="100" v-model="form.zzhxz" clearable :readonly="type == '2'"/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.enterpriseSize"
                  prop="enterpriseSize"
                  label="企业规模"
                  :rules="[{ required: formRequired.enterpriseSize, message: '该项必填', trigger: 'blur' }]"
              >
                <Input v-model="form.enterpriseSize" placeholder="请输入企业规模多少人"/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.enterpriseRevenue"
                  prop="enterpriseRevenue"
                  label="企业营收"
                  :rules="[{ required: formRequired.enterpriseRevenue, message: '该项必填', trigger: 'blur' }]"
              >
                <Input v-model="form.enterpriseRevenue" placeholder="请输入企业营收多少元/月"/>
              </FormItem>
              <FormItem
                  v-if="formIsShow.isBaseEmployment"
                  :rules="{ required: formRequired.isBaseEmployment, message: '请选择是否基层就业', trigger: 'change', validator: validateBaseLevelOrNot }"
                  prop="isBaseEmployment"
                  label="是否基层就业"
              >
                <RadioGroup v-model="form.isBaseEmployment">
                  <Radio :label="true">
                    <span>是</span>
                  </Radio>
                  <Radio :label="false">
                    <span>否</span>
                  </Radio>
                </RadioGroup>
              </FormItem>

              <FormItem v-if="formIsShow.jwxxzwmc" prop="jwxxzwmc"
                        :rules="[{ required: formRequired.jwxxzwmc, message: '该项必填', trigger: 'change' }]">
                <div class="itemLabel" slot="label" @click="clickSexCode('jwxx')">
                  <span>留学院校中文名称</span>
                </div>
                <Select class="qingwai" @on-change="fillForeignName" v-model="form.jwxxzwmc" filterable
                        clearable
                         @on-create="keyUpSearch($event, 'jwxx')">
                  <Option v-for="(item,index) in gwSchoolCodeList" :value="item.chineseName" :key="index">
                    {{ item.chineseName }}
                  </Option>
                </Select>
              </FormItem>
              <FormItem v-if="formIsShow.jwxxwwmc" label="留学院校外文名称" prop="jwxxwwmc"
                        :rules="[{ required: formRequired.jwxxwwmc, message: '该项必填', trigger: 'blur' }]">
                <Input maxlength="100" v-model="form.jwxxwwmc" readonly clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.lxgjdq" label="留学国家/地区" prop="lxgjdq"
                        :rules="[{ required: formRequired.lxgjdq, message: '该项必填', trigger: 'blur' }]">
                <Input maxlength="100" v-model="form.lxgjdq" readonly clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.lxzyzwmc" label="留学专业中文名称" prop="lxzyzwmc"
                        :rules="[{ required: formRequired.lxzyzwmc, message: '该项必填', trigger: 'blur' }]">
                <Input maxlength="100" v-model="form.lxzyzwmc" clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.lxzywwmc" label="留学专业外文名称" prop="lxzywwmc"
                        :rules="[{ required: formRequired.lxzywwmc, message: '该项必填', trigger: 'blur' }]">
                <Input maxlength="100" v-model="form.lxzywwmc" clearable/>
              </FormItem>
              <FormItem v-if="formIsShow.lxxl" label="留学学历" prop="lxxl"
                        :rules="[{ required: formRequired.lxxl, message: '该项必填', trigger: 'change' }]">
                <Select class="w-100" v-model="form.lxxl" placeholder="请选择留学学历">
                  <Option value="专科">专科</Option>
                  <Option value="本科">本科</Option>
                  <Option value="硕士">硕士</Option>
                  <Option value="博士">博士</Option>
                </Select>
              </FormItem>
              <FormItem v-if="formIsShow.zmcl" label="证明材料" prop="zmcl"
                        :rules="[{ required: formRequired.zmcl, trigger: 'change', validator: validateEvidentiaryMaterial }]">
                <uploadPicture :images="backImages" ref="supportingMaterialRef" :isEdit="true"
                               :max-count="5"/>
              </FormItem>
              <FormItem>
                <Button type="text" @click="modalVisible=false">取消</Button>
                <div style="display: inline;">
                  <Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
                </div>
              </FormItem>
            </Form>
          </div>
        </div>

      </div>
    </div>


    <Modal v-model="modal" :title="modalTableTitle" @on-ok="clickTrue">
      <Row>
        <Col span="12">
          <Input v-model="searchValueKeyword" placeholder="请输入搜索的代码关键字"
                 @on-change="handleModalTitleSearch"/>
        </Col>
        <Col span="12">
          <Input v-model="searchTitleKeyword" placeholder="请输入搜索的名称关键字"
                 @on-change="handleModalTitleSearch"/>
        </Col>
      </Row>
      <Row>
        <Col>
          <Table class="tabbki" :columns="tableColumns" :data="dataModalList" :scroll="scroll"
                 @on-row-click="handleClickRow" @on-change="chooseOneType" ref="table"></Table>
        </Col>
      </Row>
      <Row type="flex" justify="end" class="page">
        <Page :current="searchModalForm.pageNumber" :total="modalTotal" :page-size="searchModalForm.pageSize"
              @on-change="changeModalPage" size="small" show-total show-elevator></Page>
      </Row>
    </Modal>
    <el-dialog title="提示" :visible.sync="importPromptVisible" :close-on-press-escape="false"
               :close-on-click-modal="false" width="30%" center>
      <div class="fs-16 d-flex d-flex-around-center">
        <div v-if="type === 'success'">
          <Icon type="md-checkmark-circle" color="#67C23A" size="16px"/>
          <span style="color: #67c23a">{{ tipMessage }}</span>
        </div>
        <div v-if="type === 'error'">
          <Icon type="md-close-circle" color="#F56C6C" size="16px"/>
          <div style="flex: 1; display: flex; justify-content: right; align-items: center">
            <Button @click="handleExportErrData" type="info" class="mr20" >下载错误信息
            </Button>
          </div>
          <span class="class01" >{{ tipMessage }}</span>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>

// 根据你的实际请求api.js位置路径修改
import {getDictDataByType, getDictDataByTypeAndPage} from '@/api/index.js';
import {
  getJyqxInfoList,
  addJyqxInfo,
  editJyqxInfo,
  deleteJyqxInfo,
  saveOrUpdate,
  exportSelectJyqx, exportSearchJyqx, huifuApi, buquanApi
} from '../../../api/bys/jyqx/jyqx.js';
import {resetUserPass, getRoles as getRoleList, getAllDictDataList} from '@/api/index';
import {shortcuts} from '@/libs/shortcuts';
import dict from '@/views/my-components/xboot/dict';
import uploadPicThumb from '@/views/my-components/xboot/upload-pic-thumb';
import {getAllGwschoolCodeList, getGwschoolCodeList} from '@/api/gwschoolCode';
import crypto from '@/libs/secret';
import {changeRecordDataAPI, importDirectionAPI} from '../../../api/bys/destinationAfterGraduation';
import {
  employmentCategoryAPI,
  imageUploadDataApi,
  newAllProvincialDataApi,
  newProvincialDataApi,
  obtainEmploymentStatusDataAPI,
  provincialDataApi
} from '../../../api/bys/index.js';
import UploadPicture from '@/components/uploadPicture/uploadPicture.vue';
import {getAreaTreeNodes} from '@/libs/areaData';
import {copy, judgmentRequired} from '@/util/ObjectUtil';
import {left} from 'core-js/internals/array-reduce';
import historicDetail from '../../activiti/historic-detail/historicDetail.vue';
import {updateVal} from '../../../util/ObjectUtil';
import XLSX from 'xlsx';
import Cookies from 'js-cookie';
import NoData from '@/components/NoData.vue';
import {areaDataApi} from '../../../api/common';

let backImages = null; //回显数据
export default {
  name: 'jyqxManage',
  components: {
    historicDetail,
    UploadPicture,
    dict,
    NoData,
    uploadPicThumb
  },
  data() {
    return {
      listloading: true,
      quryLabelWidth: 120,
      resource: '',
      isShowType: false,
      exportResult: '',
      importErrorData: [],
      backImages, //回显数据
      type: 'success',
      tipMessage: '',
      historyType: '',
      importPromptVisible: false,
      idCard: '',
      exportingSearch: false,
      exportingSelect: false,
      exportingAll: false,
      showHistory: false,
      modelLoading: false,
      importing: false,
      importing1: false,
      importFormView: false,
      historyId: '',
      importForm: {
        file: null,
        importMode: '1'
      },
      props: {
        label: 'title',
        value: 'id',
        children: 'children'
      },
      jytype: [],
      gwSchoolCodeList: [],
      dataModalList: [],
      modalTotal: 0,
      chooseColumns: [],
      oneTypeDicts: [],
      bysqxDicts: [],
      openSearch: true, // 显示搜索
      searchValueKeyword: '',
      searchTitleKeyword: '',
      openTip: true, // 显示提示
      loading: true, // 表单加载状态
      modalType: 0, // 添加或编辑标识
      modalVisible: false, // 添加或编辑显示
      modalTitle: '', // 添加或编辑标题
      refHeight: {value: 0},
      searchModalForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
        sort: 'createTime', // 默认排序字段
        order: 'desc' // 默认排序方式
      },
      searchForm: {
        // 搜索框初始化对象
        pageNumber: 1, // 当前页数
        pageSize: 50, // 页面大小
        sort: 'createTime', // 默认排序字段
        order: 'desc' // 默认排序方式
      },
      form: {
        id: '', // 主键
        // 添加或编辑表单对象初始化数据
        onetype: '', // 就业状况
        type: [], // 就业类别 当前选中的每级value
        dwmc: '', // 单位名称
        tyshxycode: '', // 组织机构代码
        dwxz: '', // 单位性质
        dwhy: '', // 单位行业
        dwszd: null, // 单位所在地
        gzzwlb: '', // 工作职位类别
        dwlxr: '', // 单位联系人
        lxrdw: '', // 单位联系人电话
        dwdh: '', // 联系人手机
        lxrfax: '', // 联系人传真
        dwdz: '', // 单位地址
        dwyb: '', // 单位邮编
        zzhxz: '', // 工资收入
        lxremail: '', //联系人Email
        extendWord1: '', // 扩充字段1
        extendWord2: '', // 扩充字段2
        extendWord3: '', // 扩充字段3
        extendWord4: '', // 扩充字段4
        extendWord5: '', // 扩充字段5
        zmcl: '', //证明材料
        isBaseEmployment: null, // 是否基层就业
        enterpriseSize: '', // 企业规模
        enterpriseRevenue: '', // 企业营收
        major: '', // 升学专业
        lxgjdq: '', // 留学国家/地区
        jwxxzwmc: '', //  学校中文名称
        jwxxwwmc: '', // 学校外文名称
        lxzyzwmc: '', // 留学专业中文名称
        lxzywwmc: '', // 留学专业外文名称
        lxxl: '', // 留学学历
        szbj: '' //所在班级
      },
      formRequired: {
        onetype: false, // 就业状况
        type: false, // 就业类别 当前选中的每级value
        dwmc: false, // 单位名称
        tyshxycode: false, // 组织机构代码
        dwxz: false, // 单位性质
        dwhy: false, // 单位行业
        dwszd: false, // 单位所在地
        gzzwlb: false, // 工作职位类别
        dwlxr: false, // 单位联系人
        lxrdw: false, // 单位联系人电话
        dwdh: false, // 联系人手机
        lxrfax: false, // 联系人传真
        dwdz: false, // 单位地址
        dwyb: false, // 单位邮编
        zzhxz: false, // 工资收入
        lxremail: false, //联系人Email
        extendWord1: false, // 扩充字段1
        extendWord2: false, // 扩充字段2
        extendWord3: false, // 扩充字段3
        extendWord4: false, // 扩充字段4
        extendWord5: false, // 扩充字段5
        zmcl: false, //证明材料
        isBaseEmployment: false, // 是否基层就业
        enterpriseSize: false, // 企业规模
        enterpriseRevenue: false, // 企业营收
        major: false, // 升学专业
        lxgjdq: false, // 留学国家/地区
        jwxxzwmc: false, //  学校中文名称
        jwxxwwmc: false, // 学校外文名称
        lxzyzwmc: false, // 留学专业中文名称
        lxzywwmc: false, // 留学专业外文名称
        lxxl: false // 留学学历
      },
      formPlaceholder: {
        onetype: '请选择或输入', // 就业状况
        type: '请选择或输入', // 就业类别 当前选中的每级value
        dwmc: '请选择或输入', // 单位名称
        tyshxycode: '请选择或输入', // 组织机构代码
        dwxz: '请选择或输入', // 单位性质
        dwhy: '请选择或输入', // 单位行业
        dwszd: '请选择或输入', // 单位所在地
        gzzwlb: '请选择或输入', // 工作职位类别
        dwlxr: '请选择或输入', // 单位联系人
        lxrdw: '请选择或输入', // 单位联系人电话
        dwdh: '请选择或输入', // 联系人手机
        lxrfax: '请选择或输入', // 联系人传真
        dwdz: '请选择或输入', // 单位地址
        dwyb: '请选择或输入', // 单位邮编
        zzhxz: '请选择或输入', // 工资收入
        lxremail: '请选择或输入', //联系人Email
        extendWord1: '请选择或输入', // 扩充字段1
        extendWord2: '请选择或输入', // 扩充字段2
        extendWord3: '请选择或输入', // 扩充字段3
        extendWord4: '请选择或输入', // 扩充字段4
        extendWord5: '请选择或输入', // 扩充字段5
        zmcl: '请选择或输入', //证明材料
        isBaseEmployment: '请选择或输入', // 是否基层就业
        enterpriseSize: '请选择或输入', // 企业规模
        enterpriseRevenue: '请选择或输入', // 企业营收
        major: '请选择或输入', // 升学专业
        lxgjdq: '请选择或输入', // 留学国家/地区
        jwxxzwmc: '请选择或输入', //  学校中文名称
        jwxxwwmc: '请选择或输入', // 学校外文名称
        lxzyzwmc: '请选择或输入', // 留学专业中文名称
        lxzywwmc: '请选择或输入', // 留学专业外文名称
        lxxl: '请选择或输入' // 留学学历
      },
      formIsShow: {
        onetype: false, // 就业状况
        type: false, // 就业类别 当前选中的每级value
        dwmc: false, // 单位名称
        tyshxycode: false, // 组织机构代码
        dwxz: false, // 单位性质
        dwhy: false, // 单位行业
        dwszd: false, // 单位所在地
        gzzwlb: false, // 工作职位类别
        dwlxr: false, // 单位联系人
        lxrdw: false, // 单位联系人电话
        dwdh: false, // 联系人手机
        lxrfax: false, // 联系人传真
        dwdz: false, // 单位地址
        dwyb: false, // 单位邮编
        zzhxz: false, // 工资收入
        lxremail: false, //联系人Email
        extendWord1: false, // 扩充字段1
        extendWord2: false, // 扩充字段2
        extendWord3: false, // 扩充字段3
        extendWord4: false, // 扩充字段4
        extendWord5: false, // 扩充字段5
        zmcl: false, //证明材料
        isBaseEmployment: false, // 是否基层就业
        enterpriseSize: false, // 企业规模
        enterpriseRevenue: false, // 企业营收
        major: false, // 升学专业
        lxgjdq: false, // 留学国家/地区
        jwxxzwmc: false, //  学校中文名称
        jwxxwwmc: false, // 学校外文名称
        lxzyzwmc: false, // 留学专业中文名称
        lxzywwmc: false, // 留学专业外文名称
        lxxl: false // 留学学历
      },
      // 表单验证规则
      formValidate: {},
      submitLoading: false, // 添加或编辑提交状态
      showCode: '', //双击行传递的值
      modalDict: '',
      selectList: [], // 多选数据
      pyfsList: [],
      dwhyList: [], //单位行业
      gzzwlbList: [], //单位行业
      columns: [],
      columns_1: [
        // 表头
        // {
        //   type: 'selection',
        //   width: 60,
        //   align: 'center'
        // },
        // {
        //   type: 'index',
        //   title: '序号',
        //   width: 70,
        //   align: 'center'
        // },
        {
          title: '数据来源',
          minWidth: 100,
          key: 'importFlag', // 0是学生填报 1是学校导入 2是学院修改 3是学校修改
          sortable: false,
          render: (h, params) => {
            if (params.row.importFlag == 0) {
              return h('span', '学生填报');
            } else if (params.row.importFlag == 1) {
              return h('span', '学校导入');
            } else if (params.row.importFlag == 2) {
              return h('span', '学院修改');
            } else if (params.row.importFlag == 3) {
              return h('span', '学校修改');
            }
          }
        },
        /* {
             title: '数据上报状态',
             minWidth: 100,
             key: 'needReport', // 0需要上报 1不需要上报(已上报)
             sortable: false,
             render: (h, params) => {
                 if (params.row.needReport == 0) {
                     return h('span', '待上报');
                 } else if (params.row.needReport == 1) {
                     return h('span', '已上报');
                 }
             }
         },*/
        {
          title: '院校名称',
          key: 'yxmc',
          minWidth: 200,
          sortable: false
        },
        {
          title: '院系名称',
          key: 'xsh',
          minWidth: 180,
          sortable: false
        },
        {
          title: '专业',
          key: 'major',
          minWidth: 180,
          sortable: false
        },
        {
          title: '所在班级',
          key: 'szbj',
          minWidth: 180,
          sortable: false
        },
        {
          title: '姓名',
          key: 'xm',
          minWidth: 100,
          sortable: false
        },
        {
          title: '身份证号',
          key: 'sfzh',
          minWidth: 180,
          sortable: false
        },
        {
          title: '考生号',
          key: 'ksh',
          minWidth: 160,
          sortable: false
        },
        {
          title: '学号',
          key: 'xh',
          minWidth: 140,
          sortable: false
        },
        {
          title: '培养方式',
          key: 'pyfsCode',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            let dict = this.pyfsList.find(item => item.value === params.row.pyfsCode);
            return h('div', dict ? dict.title : '');
          }
        },
        {
          title: '就业状况',
          key: 'onetype',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            if (params.row.onetype === '5') {
              return h('span', '暂未登记或上报');
            } else {
              let arr = this.oneTypeDicts.filter(e => e.value == params.row.onetype);
              return h('span', arr && arr.length > 0 ? arr[0].title : '');
            }
          }
        },
        {
          title: '就业类别',
          key: 'type',
          minWidth: 700,
          sortable: false,
          render: (h, params) => {
            let arr = this.jytype.filter(e => e.id == params.row.type);
            return h('span', arr && arr.length > 0 ? arr[0].title : '');
          }
        },
        {
          title: '单位名称',
          key: 'dwmc',
          minWidth: 250,
          sortable: false
        },
        {
          title: '单位统一社会信用代码',
          key: 'tyshxycode',
          minWidth: 180,
          sortable: false
        },
        {
          title: '单位性质',
          key: 'dwxz',
          minWidth: 120,
          sortable: false,
          render: (h, params) => {
            let arr = this.unitNatureDicts.filter(e => e.value == params.row.dwxz);
            return h('span', arr && arr.length > 0 ? arr[0].title : '');
          }
        },
        {
          title: '单位行业',
          key: 'dwhy',
          minWidth: 280,
          sortable: false,
          render: (h, params) => {
            let arr = this.unitIndustryDicts.filter(e => e.value == params.row.dwhy);
            return h('span', arr && arr.length > 0 ? arr[0].title : '');
          }
        },
        {
          title: '单位所在地',
          key: 'dwszd',
          minWidth: 150,
          sortable: false,
          render: (h, params) => {
            if (params.row.dwszd && params.row.dwszd.indexOf(',') != -1) {
              let arr = this.areaList.filter(item => item.code == params.row.dwszd.split(',')[2]);
              return h('span', arr && arr.length > 0 ? arr[0].allName : '');
            } else {
              return h('span', '');

            }
          }
        },
        {
          title: '工作职位类别',
          key: 'gzzwlb',
          minWidth: 180,
          sortable: false,
          render: (h, params) => {
            let arr = this.jobPositionCategoryDicts.filter(e => e.value == params.row.gzzwlb);
            return h('span', arr && arr.length > 0 ? arr[0].title : '');
          }
        },
        {
          title: '单位联系人',
          key: 'dwlxr',
          minWidth: 120,
          sortable: false
        },
        {
          title: '单位电话',
          key: 'lxrdw',
          minWidth: 180,
          sortable: false
        },
        {
          title: '联系人手机',
          key: 'dwdh',
          minWidth: 180,
          sortable: false
        },
        {
          title: '单位电子邮箱',
          key: 'lxremail',
          minWidth: 200,
          sortable: false
        },
        {
          title: '联系人传真',
          key: 'lxrfax',
          minWidth: 180,
          sortable: false
        },
        {
          title: '单位地址',
          key: 'dwdz',
          minWidth: 350,
          sortable: false
        },
        {
          title: '单位邮编',
          key: 'dwyb',
          minWidth: 120,
          sortable: false
        },
        {
          title: '协议书编号',
          key: 'xysbh',
          minWidth: 120,
          sortable: false
        },
        {
          title: '转正后薪资（元/月）',
          key: 'zzhxz',
          minWidth: 160,
          sortable: false
        },
        {
          title: '留学国家/地区',
          key: 'lxgjdq',
          minWidth: 120,
          sortable: false
        },
        {
          title: '境外学校中文名称',
          key: 'jwxxzwmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '留学院校外文名称',
          key: 'jwxxwwmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '留学专业中文名称',
          key: 'lxzyzwmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '留学专业外文名称',
          key: 'lxzywwmc',
          minWidth: 120,
          sortable: false
        },
        {
          title: '留学学历',
          key: 'lxxl',
          minWidth: 120,
          sortable: false
        },
        {
          title: '更新时间',
          key: 'updateTime',
          width: 180,
          sortable: false
        },
        {
          title: '去向登记状态',
          slot: 'status',
          key: 'status',
          align: 'center',
          width: 120,
          fixed: 'right'
        },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          width: 200,
          fixed: 'right',
          render: (h, params) => {

            // if (params.row.onetype === '5') {
            //     return h();
            // }

            return h('div', [
              h(
                  'a',
                  {
                    // style: {
                    //     display: this.hasPermission(this, 'edit') ? 'inline-block' : "none",
                    // },
                    style: {
                      display: 'inline-block'
                    },
                    on: {
                      click: () => {
                        this.sjclaib(params.row);
                      }
                    }
                  },
                  '编辑'
              ),
              h('Divider', {
                props: {
                  type: 'vertical'
                }
              }),
              h(
                  'a',
                  {
                    style: {
                      display: 'inline-block'
                    },
                    on: {
                      click: () => {
                        this.history(params.row);
                      }
                    }
                  },
                  '历史'
              )
            ]);
          }
        }
      ],
      defultColumns: [
        {
          title: '代码',
          key: 'value',
          sortable: false,
          align: 'center'
        },
        {
          title: '名称',
          key: 'title',
          sortable: false,
          align: 'center'
        }
      ],
      data: [], // 表单数据
      total: 0, // 表单数据总数
      scroll: {
        y: '200px' // 表头固定的高度
      },
      modal: false,
      modalTableTitle: '',
      tableColumns: [
        {
          title: '代码',
          key: 'value',
          sortable: false,
          align: 'center'
        },
        {
          title: '名称',
          key: 'title',
          sortable: false,
          align: 'center'
        }
      ],
      jwxxColumns: [
        {
          title: '国家/地区',
          key: 'gjOrDq'
        },
        {
          title: '外文名称',
          key: 'foreignName'
        },
        {
          title: '中文名称',
          key: 'chineseName'
        }
      ],
      showRight: true,
      unitIndustryDicts: [],
      unitNatureDicts: [],
      jobPositionCategoryDicts: [],
      provincesAndMunicipalitiesProps: {
        label: 'name',
        value: 'code',
        children: 'children'
      },
      areaCodeList: [], //地区代码表
      validatelocationOfTheUnit: (rule, value, callback) => {
        if (this.form.dwszd === null || this.form.dwszd === '') {
          callback(new Error('请选择单位所在地'));
        } else {
          callback();
        }
      },
      validateOrganizingInstitutionBarCode: (rule, value, callback) => {
        if (this.formRequired.tyshxycode) {
          const result = this.verify(this.form.tyshxycode);
          if (result) {
            callback();
          } else {
            callback(new Error('请输入正确得组织机构代码'));
          }
        } else {
          callback();
        }
      },
      validateBaseLevelOrNot: (rule, value, callback) => {
        if (this.formRequired.isBaseEmployment) {
          if (this.form.isBaseEmployment === null) {
            callback(new Error('请选择是否基层就业'));
          } else {
            callback();
          }
        } else {
          callback();
        }
      },
      validateEvidentiaryMaterial: (rule, value, callback) => {
        if (this.formRequired.zmcl) {
          if (this.$refs.supportingMaterialRef.formFile.length > 0 || this.form.zmcl !== null) {
            callback();
          } else {
            callback(new Error('请上传证明材料'));
          }
        } else {
          callback();
        }
      },
      validateEmploymentCategory: (rule, value, callback) => {
        if (this.form.type !== null || this.form.type !== '') {
          callback();
        } else {
          callback(new Error('请选择就业类别'));
        }
      },
      employmentCategory: '',
      nameOfOrganizationLabel: '单位名称',
      locationOfTheUnitLabel: '单位所在地',
      locationOfTheUnitList: [],
      isSubmit: false,
      areaList: []
    };
  },
  watch: {
    modalDict(val) {
      return this.handleWatchModalDictData(this.currentModalSearch);
    }
  },
  methods: {
    setStatus(i){
      if (i=== ''){
        this.searchForm.status = ''
      }else {
        this.searchForm.status = Number(i)
      }
      this.handleSearch()
    },
    pyfsCodeValue(data) {
      let dict = this.pyfsList.find(item => item.value === data);
      return dict ? dict.title : ''
    },
    oneTypeValue(data) {
      if (data === '5') {
        return '暂未登记或上报'
      } else {
        let arr = this.oneTypeDicts.filter(e => e.value == data);
        return arr && arr.length > 0 ? arr[0].title : ''
      }
    },
    jyTypeValue(data) {
      let arr = this.jytype.filter(e => e.id == data);
      return arr && arr.length > 0 ? arr[0].title : ''
    },
    dwxzValue(data) {
      let arr = this.unitNatureDicts.filter(e => e.value == data);
      return arr && arr.length > 0 ? arr[0].title : ''
    },
    dwhyValue(data) {
      let arr = this.unitIndustryDicts.filter(e => e.value == data);
      return arr && arr.length > 0 ? arr[0].title : ''
    },
    dwszdValue(data) {
      if (data && data.indexOf(',') != -1) {
        let arr = this.areaList.filter(item => item.code == data.split(',')[2]);
        return arr && arr.length > 0 ? arr[0].allName : ''
      } else {
        return ''

      }
    },
    gzzwlbValue(data) {
      let arr = this.jobPositionCategoryDicts.filter(e => e.value == data);
      return arr && arr.length > 0 ? arr[0].title : ''
    },
    async getareaData() {
      let res = await areaDataApi();
      if (res.code === 200) {
        this.areaList = res.result;
      }
    },
    //就业类别
    getEmploymentCategory() {
      employmentCategoryAPI().then(res => {
        if (res.success) {
          this.jytype = res.result;
        }
      });
    },
    // region TODO 获取就业类别的选中ID
    handleChange(value) {
      this.$nextTick(() => {
        const formData = copy(this.form);
        this.employmentCategory = value[value.length - 1];
        this.form.dwxz = '';
        this.form.dwhy = '';
        this.form.dwszd = [];
        this.form.gzzwlb = '';
        this.form.dwmc = '';

        if (formData.onetype == 2) {
          this.nameOfOrganizationLabel = '学校名称';
          this.locationOfTheUnitLabel = '学校所在地';
        } else {
          this.nameOfOrganizationLabel = '单位名称';
          this.locationOfTheUnitLabel = '单位所在地';
        }
        judgmentRequired(formData.onetype, this.employmentCategory, this.form, this.formRequired, this.formPlaceholder, this.formIsShow);
      });
    },
    // endregion
    //历史
    history(v) {
      if (!v.sfzh) {
        this.$Message.warning({
          content: '暂无历史',
          duration: 5,
          closable: true
        });
        return;
      }
      this.showHistory = true;
      this.historyType = '2';
      this.idCard = v.sfzh;
      // 接口给你放这
      // getJyqxRecordByUserId({userId: v.userId})
      // this.historyId = v.xjid
    },
    // region TODO 校验组织机构代码
    verify(value) {
      if (value.length == 15) {
        return false;
      } else {
        let reg = /(^(?:(?![IOZSV])[\dA-Z]){2}\d{6}(?:(?![IOZSV])[\dA-Z]){10}$)|(^\d{15}$)/;
        return reg.test(value);
      }
    },

    // region TODO 获取单位所在地数据
    locationOfTheUnit() {
      newProvincialDataApi().then(res => {
        if (res.success) {
          this.areaCodeList = res.result;
        }
      });
    },
    huifu() {
      huifuApi().then(res => {
        if (res.code === 200) {
          this.$Message.success('成功');
        } else {
          this.$Message.error('失败');
        }
      });
    },
    buquan() {
      buquanApi().then(res => {
        if (res.code === 200) {
          this.$Message.success('成功');
        } else {
          this.$Message.error('失败');
        }
      });
    },
    // endregion
    // region TODO 导入生源信息 下载导入模板
    handleUpload(file) {
      const fileExt = file.name
          .split('.')
          .pop()
          .toLocaleLowerCase();
      // if (!(fileExt == 'xlsx')) {
      //   // this.$Modal.error({
      //   //   title: '文件类型错误',
      //   //   content: '所选文件‘ ' + file.name + ' ’不是EXCEL文件，请选择后缀为.xlsx的文件。',
      //   //   closable: true
      //   // });
      //   // this.$Notice.warning({
      //   //     title: '文件类型错误',
      //   //     desc: '所选文件‘ ' + file.name + ' ’不是EXCEL文件，请选择后缀为.xlsx的文件。'
      //   // });
      // } else {
      //   this.importForm.file = file;
      // }
      this.importForm.file = file;
      return false;
    },
    dropExportSearch() {
      this.exportingSearch = true;
      exportSearchJyqx(this.searchForm).then(res => {
        this.exportingSearch = false;
        const blob = new Blob([res], {type: 'charset=utf-8'});
        let url = window.URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.style.display = 'none';
        link.href = url;
        link.setAttribute('download', '去向登记信息.xlsx');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link); // 删除节点
        window.URL.revokeObjectURL(url); //释放该 url
      });
    },
    dropExportSelect() {
      let ids = [];
      this.selectList.forEach(function (e) {
        ids.push(e.id);
      });
      if (ids.length == 0) {
        this.$Message.warning({
          content: '请选择数据',
          duration: 5,
          closable: true
        });
        return;
      }
      this.exportingSelect = true;
      exportSelectJyqx({ids: ids}).then(res => {
        this.exportingSelect = false;
        // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
        const blob = new Blob([res], {type: 'charset=utf-8'});
        let url = window.URL.createObjectURL(blob);

        const link = document.createElement('a');
        link.style.display = 'none';
        link.href = url;
        link.setAttribute('download', '去向登记信息.xlsx');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link); // 删除节点
        window.URL.revokeObjectURL(url); //释放该 url
      });
    },

    dropExportAll() {
      this.exportingAll = true;
      let ids = [];
      exportSelectJyqx({ids: ids}).then(res => {
        this.exportingAll = false;
        // type的格式可以可以设置，可以把appcation/json设置进去，然后设置导出的类型
        const blob = new Blob([res], {type: 'charset=utf-8'});
        let url = window.URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.style.display = 'none';
        link.href = url;
        link.setAttribute('download', '去向登记信息.xlsx');
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link); // 删除节点
        window.URL.revokeObjectURL(url); //释放该 url
      });
    },
    downloadTemple() {
      window.location.href = process.env.BASE_URL + '去向登记导入模板.xlsx';
    },

    handleExportErrData() {
      let data = this.importErrorData;
      data = data.map(item => {
        return {
          errorMsg: item.errorMsg,
          yxdm: item.yxdm,
          ksh: item.ksh,
          sfzh: item.sfzh,
          xm: item.xm,
          xbdm: item.xbdm,
          mzdm: item.mzdm,
          zzmmdm: item.zzmmdm,
          xldm: item.xldm,
          zydm: item.zydm,
          pyfsdm: item.pyfsdm,
          syszddm: item.syszddm,
          xz: item.xz,
          bysj: item.bysj,
          rxsj: item.rxsj,
          knslbdm: item.knslbdm,
          sfslbdm: item.sfslbdm,
          byqxdm: item.byqxdm,
          dwmc: item.dwmc,
          dwxz: item.dwxz,
          dwhy: item.dwhy,
          dwszd: item.dwszd,
          tyshxycode: item.tyshxycode,
          gzzwlb: item.gzzwlb,
          bdzqflbdm: item.bdzqflbdm,
          qwdwszddm: item.qwdwszddm,
          bdzbh: item.bdzbh,
          bdqssj: item.bdqssj,
          extendWord1: item.extendWord1,
          extendWord2: item.extendWord2,
          extendWord3: item.extendWord3,
          extendWord4: item.extendWord4,
          extendWord5: item.extendWord5,
          dxhwpdw: item.dxhwpdw,
          mobile: item.mobile,
          jtdh: item.jtdh,
          dwlxr: item.dwlxr,
          lxrdh: item.lxrdh,
          lxrsj: item.lxrsj,
          xxxs: item.xxxs,
          lxremail: item.lxremail,
          dwdz: item.dwdz,
          sfjdlk: item.sfjdlk,
          xh: item.xh,
          szyx: item.szyx,
          gzkzksbzdm: item.gzkzksbzdm,
          zyfx: item.zyfx,
          zy: item.zy
        };
      });
      const wb = XLSX.utils.book_new();
      data = [{
        errorMsg: '错误信息',
        yxdm: 'YXDM',
        ksh: 'KSH',
        sfzh: 'SFZH',
        xm: 'XM',
        xbdm: 'XBDM',
        mzdm: 'MZDM',
        zzmmdm: 'ZZMMDM',
        xldm: 'XLDM',
        zydm: 'ZYDM',
        pyfsdm: 'PYFSDM',
        syszddm: 'SYSZDDM',
        xz: 'XZ',
        bysj: 'BYSJ',
        rxsj: 'RXSJ',
        knslbdm: 'KNSLBDM',
        sfslbdm: 'SFSLBDM',
        byqxdm: 'BYQXDM',
        dwmc: 'DWMC',
        dwxz: 'DWXZDM',
        dwhy: 'DWHYDM',
        dwszd: 'DWSZDDM',
        tyshxycode: 'DWZZJGDM',
        gzzwlb: 'GZZWLBDM',
        bdzqflbdm: 'BDZQFLBDM',
        bdzqwdwmc: 'BDZQWDWMC',
        qwdwszddm: 'QWDWSZDDM',
        bdzbh: 'BDZBH',
        bdqssj: 'BDQSSJ',
        extendWord1: 'KZX1',
        extendWord2: 'KZX2',
        extendWord3: 'KZX3',
        extendWord4: 'KZX4',
        extendWord5: 'KZX5',
        dxhwpdw: 'DXHWPDW',
        mobile: 'MOBILEPHON',
        jtdh: 'JTDH',
        dwlxr: 'DWLXR',
        lxrdh: 'LXRDH',
        lxrsj: 'LXRSJ',
        xxxs: 'XXXS',
        lxremail: 'LXRDZYX',
        dwdz: 'DWDZ',
        sfjdlk: 'SFJDLK',
        xh: 'XH',
        szyx: 'SZYX',
        gzkzksbzdm: 'GZKZKSBZDM',
        zyfx: 'ZYFX',
        zy: 'ZY'
      }, ...data];

      const ws = XLSX.utils.json_to_sheet(data, {skipHeader: true});
      XLSX.utils.book_append_sheet(wb, ws, '错误信息');
      XLSX.writeFile(wb, '错误信息.xlsx');
    },

    async importFormOk() {
      if (this.importForm.file == null) {
        this.$Message.info('请选择文件');
        return;
      }
      let formData = new FormData();

      formData.append('importMode', this.importForm.importMode); // 添加参数
      formData.append('file', this.importForm.file);
      this.importing = true;
      let accessToken = sessionStorage.getItem('accessToken');
      let baseUrl = config.baseApi;
      // fetch(baseUrl + '/bysJyqxInfo/import', {
      //     method: 'post',
      //     headers: {
      //         accessToken: accessToken
      //     },
      //     body: formData
      // })
      this.postRequest('/bysJyqxInfo/import', formData, {transformRequest: []}).then(res => {
        let exportResult = res.result.result;
        if (exportResult.includes('导入失败')) {
          this.$Message.error('导入失败');
          this.tipMessage = exportResult;
          this.type = 'error';
          this.importErrorData = res.result.importErrorVoList;
          this.importPromptVisible = true;
          this.importing = false;
          this.importFormcCncel();
          this.getDataList();
        } else {
          this.$Message.success('导入成功');
          this.tipMessage = res.result.result;
          this.type = 'success';
          this.importPromptVisible = true;
          this.importing = false;
          this.importFormcCncel();
          this.getDataList();
        }
        // 下载
        // const url = window.URL.createObjectURL(res);
        // const link = document.createElement('a');
        // link.style.display = 'none';
        // link.href = url;
        // link.setAttribute('download', '导入失败数据汇总.xlsx');
        // document.body.appendChild(link);
        // link.click();
      });
      // .then(res => res.blob())
      //     this.postRequest( '/bysJyqxInfo/import', formData)


      // importDirectionAPI(formData).then(res => {
      //     if (res.code === 200) {
      //         this.tipMessage = res.message;
      //         this.type = 'success';
      //         this.importPromptVisible = true;
      //     } else if (res.code === 201) {
      //         this.tipMessage = res.message;
      //         this.type = 'warning';
      //         this.importPromptVisible = true;
      //         // this.$Message.success(res.message)
      //         const byteArray = Uint8Array.from(atob(res.result), c => c.charCodeAt(0));
      //         const blob = new Blob([byteArray], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
      //         // 创建临时 URL 对象
      //         const url = URL.createObjectURL(blob);
      //         const downloadLink = document.createElement('a');
      //         downloadLink.href = url;
      //         downloadLink.download = '导入失败数据汇总.xlsx'; // 设置文件名
      //         downloadLink.click();
      //     } else {
      //         this.type = 'error';
      //         this.tipMessage = res.message;
      //         this.importPromptVisible = true;
      //         // this.$Message.error(res.message)
      //         const byteArray = Uint8Array.from(atob(res.result), c => c.charCodeAt(0));
      //         const blob = new Blob([byteArray], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
      //         // 创建临时 URL 对象
      //         const url = URL.createObjectURL(blob);
      //         const downloadLink = document.createElement('a');
      //         downloadLink.href = url;
      //         downloadLink.download = '导入失败数据汇总.xlsx'; // 设置文件名
      //         downloadLink.click();
      //     }
      //     // this.submitLoading = false;
      //     this.importing = false;
      //     this.importFormcCncel();
      //     this.getDataList();
      // });
    },
    importFormcCncel() {
      this.importForm.file = null;
      this.importFormView = false;
    },
    // endregion
    fillForeignName() {
      const selectedChineseName = this.form.jwxxzwmc;
      const matchedSchool = this.gwSchoolCodeList.find(item => item.chineseName === selectedChineseName);
      if (matchedSchool) {
        this.form.jwxxwwmc = matchedSchool.foreignName;
        this.form.lxgjdq = matchedSchool.gjOrDq;
      }
    },
    tableheig() {
      var bbb = document.getElementsByClassName('calc-px-height')[0].scrollHeight;
      var aaa = document.getElementsByClassName('calc-px-height')[0].children[0].children[0].children[1];
      var ccc = document.getElementsByClassName('calc-px-height')[0].children[0].children[0].children[0].scrollHeight;
      var ddd = bbb - ccc;
      aaa.style.height = `${ddd}px`;

      if (this.searchForm.pageSize === 10) {
        this.height1 = 0;
      } else {
        this.height1 = document.getElementsByClassName('calc-px-height')[0].scrollHeight;
        if (this.total < this.searchForm.pageNumber * this.searchForm.pageSize) {
          var r = (this.searchForm.pageNumber - 1) * this.searchForm.pageSize;
          var a = this.total - r;
          var s = a * 43 + 65;
          if (s < this.height1) {
            this.height1 = 0;
          }
        }
      }
      if (this.total < 10) {
        this.height1 = 0;
      }
    },
    changeModalPage(v) {
      this.searchModalForm.pageNumber = v;
      this.handleWatchModalDictData(this.currentModalSearch);
    },
    handleModalTitleSearch() {
      this.handleWatchModalDictData(this.currentModalSearch);
    },
    changeDwszd(e) {
      console.log('选择的dwszd', e);
    },
    keyUpSearch(e, value) {
      this.showDict(value);
      if (e.keyCode == 13 || e.keyCode == 9) {
        if (value == 'dwxz') {
          this.form.dwxz = this.unitNatureDicts.find(item => item.value == e.target.value).title;
        } else if (value == 'dwhy') {
          this.form.dwhy = this.unitIndustryDicts.find(item => item.value == e.target.value).title;
        } else if (value == 'gzzwlb') {
          this.form.gzzwlb = this.jobPositionCategoryDicts.find(item => item.value == e.target.value).title;
        } else if (value == 'onetype') {
          this.form.onetype = this.oneTypeDicts.find(item => item.value == e.target.value).title;
        } else if (value == 'type') {
          this.form.type = this.bysqxDicts.find(item => item.value == e.target.value).title;
        } else if (value == 'jwxx') {
          this.form.jwxxzwmc = this.gwSchoolCodeList.find(item => item.chineseName == e.target.value).chineseName;
        }
      }
    },
    clickSexCode(e) {
      this.showCode = e;
      this.modal = true;
      this.searchModalForm.pageNumber = 1;
      this.searchTitleKeyword = '';
      this.searchValueKeyword = '';
      this.currentModalSearch = e;
      this.showDict(e);
    },
    showDict(e) {
      this.tableColumns = this.defultColumns;
      if (e == 'dwxz') {
        this.modalTableTitle = '单位性质';
        this.modalDict = 'dwxz';
      } else if (e == 'dwhy') {
        this.modalTableTitle = '单位行业';
        this.modalDict = 'dwhy';
      } else if (e == 'gzzwlb') {
        this.modalTableTitle = '工作职位类别';
        this.modalDict = 'gzzwlb';
      } else if (e == 'onetype') {
        this.modalTableTitle = '就业状况';
        this.modalDict = 'onetype';
      } else if (e == 'type') {
        this.modalTableTitle = '就业类别';
        this.modalDict = 'type';
      } else if (e == 'jwxx') {
        this.tableColumns = this.jwxxColumns;
        this.modalTableTitle = '境外学校代码';
        this.modalDict = 'jwxx';
      }
      this.handleWatchModalDictData(this.currentModalSearch);
    },
    init() {
      this.getDataList();
      this.locationOfTheUnit();
      this.getDictData();

      // this.getByQxs();
    },
    handleWatchModalDictData(e) {
      this.dataModalList = [];
      if (e === 'dwxz') {
        //单位性质
        getDictDataByTypeAndPage({
          ...this.searchModalForm,
          type: 'unit-nature',
          value: this.searchValueKeyword,
          title: this.searchTitleKeyword
        }).then(res => {
          if (res.success) {
            this.dataModalList = res?.result?.content || [];
            this.modalTotal = res?.result?.totalElements || 0;
          }
        });
      } else if (e === 'dwhy') {
        //单位行业
        getDictDataByTypeAndPage({
          ...this.searchModalForm,
          type: 'unit-industry',
          value: this.searchValueKeyword,
          title: this.searchTitleKeyword
        }).then(res => {
          if (res.success) {
            this.dataModalList = res?.result?.content || [];
            this.modalTotal = res?.result?.totalElements || 0;
          }
        });
      } else if (e === 'gzzwlb') {
        getDictDataByTypeAndPage({
          ...this.searchModalForm,
          type: 'job-position-category',
          value: this.searchValueKeyword,
          title: this.searchTitleKeyword
        }).then(res => {
          if (res.success) {
            this.dataModalList = res?.result?.content || [];
            this.modalTotal = res?.result?.totalElements || 0;
          }
        });
      } else if (e === 'onetype') {
        // getDictDataByTypeAndPage({...this.searchModalForm, type: 'where-manage-type', value: this.searchValueKeyword, title: this.searchTitleKeyword}).then((res) => {
        //   if (res.success) {
        //     this.dataModalList = res.result.content
        //     this.modalTotal = res.result.totalElements
        //   }
        // });
        obtainEmploymentStatusDataAPI()
            .then(res => {
              if (res.success) {
                this.dataModalList = res?.result || [];
              }
            })
            .catch(e => {
              console.log(e);
            });
      } else if (e === 'type') {
        this.getByQxs(this.form.onetype);
        this.dataModalList = this.bysqxDicts;
        // getDictDataByTypeAndPage({...this.searchModalForm, type: 'where-manage-type', value: this.searchValueKeyword, title: this.searchTitleKeyword}).then((res) => {
        //   if (res.success) {
        //     this.dataModalList = res.result.content
        //     this.modalTotal = res.result.totalElements
        //   }
        // });
      } else if (e === 'jwxx') {
        getGwschoolCodeList({
          ...this.searchModalForm,
          foreignName: this.searchValueKeyword,
          chineseName: this.searchTitleKeyword
        }).then(res => {
          if (res.success) {
            this.dataModalList = res.result.records;
            this.modalTotal = res.result.total;
          }
        });
      }
    },
    // getData(v){
    //   //单位性质
    //   getDictDataByTypeAndPage("unit-nature").then(res => {
    //     if (res.success) {
    //       this.unitNatureDicts = res.result;
    //     }
    //   })
    //   getDictDataByTypeAndPage("unit-industry").then(res => {
    //     if (res.success) {
    //       this.unitIndustryDicts = res.result;
    //     }
    //   })
    //   //工作职位类别
    //   getDictDataByTypeAndPage("job-position-category").then(res => {
    //     if (res.success) {
    //       this.jobPositionCategoryDicts = res.result;
    //     }
    //   })
    // },
    getDictData() {
      newAllProvincialDataApi().then(res => {
        this.locationOfTheUnitList = res.result;
      });

      //单位性质
      getDictDataByType('unit-nature').then(res => {
        if (res.success) {
          this.unitNatureDicts = res.result;
        }
      });
      // 国外学校代码
      getAllGwschoolCodeList().then(res => {
        if (res.success) {
          this.gwSchoolCodeList = res.result;
        }
      });
      //培养方式
      getDictDataByType('training-methods').then(res => {
        if (res.success) {
          this.pyfsList = res.result;
        }
      });
      // 工作职位类别
      getDictDataByType('flatType').then(res => {
        if (res.success) {
          this.gzzwlbList = res.result;
        }
      });
      // 单位行业
      getDictDataByType('unit-industry').then(res => {
        if (res.success) {
          this.dwhyList = res.result;
        }
      });
      //获取就业状况数据
      obtainEmploymentStatusDataAPI()
          .then(res => {
            if (res.success) {
              this.oneTypeDicts = res?.result || [];
              this.oneTypeDicts.push({title: '暂未登记或上报', value: 5});
            }
          })
          .catch(e => {
            console.log(e);
          });

      //学历层次
      // getDictDataByType("unit-industry").then(res=>{
      //   if (res.success) {
      //     this.unitIndustryDicts = res.result;
      //   }
      // })

      //单位行业
      getDictDataByType('unit-industry').then(res => {
        if (res.success) {
          this.unitIndustryDicts = res.result;
        }
      });

      //单位性质
      // getDictDataByType("unit-nature").then(res => {
      //   if (res.success) {
      //     this.unitNatureDicts = res.result;
      //   }
      // })
      //工作职位类别
      getDictDataByType('job-position-category').then(res => {
        if (res.success) {
          this.jobPositionCategoryDicts = res.result;
        }
      });
    },
    async chooseOneType(val) {
      this.getByQxs(val);
      this.isShowType = true;
      // let res = await this.postRequest("/whereManage/getAll", {whereManageType: val});
      // if (res.success) {
      //   this.bysqxDicts = res.result.map(e=>{
      //     return {title:e.whereManageName,
      //       value:""+e.value
      //     }
      //   });
      // }
    },
    async getByQxs(val) {
      // const year = new Date().getFullYear()
      const year = '2023';
      let res = await this.postRequest('/gqQxCode/getTree', {dictMatch: val, version: '2023'});
      if (res.success) {
        this.$nextTick(() => {
          this.bysqxDicts = res?.result || [];
          judgmentRequired(this.form.onetype, this.form.type, this.form, this.formRequired, this.formPlaceholder, this.formIsShow);
        });
        // this.bysqxDicts = res.result.map(e=>{
        //   return {title:e.whereManageName,
        //     value:""+e.value
        //   }
        // });
      }
    },
    // async getByQxs(val){
    //   let res = await this.postRequest("/whereManage/getAll", {whereManageType: val});
    //   if (res.success) {
    //     this.bysqxDicts = res.result.map(e=>{
    //       return {title:e.whereManageName,
    //         value:""+e.value
    //       }
    //     });
    //   }
    // },

    // 显示隐藏右侧区域
    clickShowRight() {
      this.showRight = !this.showRight;
    },
    changePage(v) {
      this.searchForm.pageNumber = v;
      this.getDataList();
      this.clearSelectAll();
    },

    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.getDataList();
    },
    handleSearch() {
      this.searchForm.pageNumber = 1;
      this.searchForm.pageSize = 50;
      this.getDataList();
    },
    // 重置
    async handleReset() {
      this.$refs.searchForm.resetFields();
     this.searchForm= {
       pageNumber: 1, // 当前页数
       pageSize: 50, // 页面大小
       sort: 'createTime', // 默认排序字段
       order: 'desc', // 默认排序方式
       gxcode:'',
       gxmc:'',
       xm:'',
       szbj:'',
       ksh:'',
       xh:'',
       sfzh:'',
       xlccs:'',
       dwmc:'',
       jwxxzwmc:'',
       zy:'',
       dwhy:'',
       yxmc:'',
       type:'',
       pyfsList:'',
       onetype:'',
       status:'',
       importFlag:''
      }
      // 重新加载数据
      await this.getDataList();
    },
    changeSort(e) {
      this.searchForm.sort = e.key;
      this.searchForm.order = e.order;
      if (e.order === 'normal') {
        this.searchForm.order = '';
      }
      this.getDataList();
    },
    clearSelectAll() {
      this.$refs.tableA.clearSelection();
    },
    changeSelect(e) {
      this.selectList = e;
    },
    getDataList() {
      this.listloading = true
      getJyqxInfoList(this.searchForm)
          .then(res => {
            this.loading = false;
            this.listloading = false
            if (res.code == 200) {
              let value = res?.result || [];
              this.data = value.result;
              this.total = value.total;
              // this.tableheig();
              this.data.forEach(el => {
                let dataRow = this.pyfsList.find(item => item.value == el.pyfsCode);
                let dict = dataRow?.title || '';
                el.pyfs = dict ? dict : '';
              });
              // (this.data.length == 0 && this.searchForm.pageNumber > 1) {
              //this.searchForm.pageNumber -= 1;
              //this.getDataList();
              //}
            }
          })
          .finally(() => {
            this.loading = false;
          });
    },
    clickQx(e) {
      this.showCode = e;
      this.modal = true;
    },
    clickTrue() {
      this.modal = false;
      this.form[this.showCode] = this.rowList.value;
      if (this.showCode === 'onetype') {
        this.chooseOneType(this.rowList.value);
      }
    },
    // table
    handleClickRow(row) {
      this.rowList = row;
      this.clickTrue();
    },
    handleSubmit() {
      if (!this.isSubmit) {
        this.$message.warning('该生暂未登记或上报，不允许编辑修改！');
        return;
      }
      this.$refs.form.validate(async valid => {
        if (valid) {
          this.submitLoading = true;
          if (this.modalType === 0) {
            // 添加 避免编辑后传入id等数据 记得删除
            delete this.form.id;
            saveOrUpdate({...this.form, type: this.employmentCategory}).then(res => {
              this.submitLoading = false;
              if (res.success) {
                this.$Message.success('操作成功');
                this.getDataList();
                this.modalVisible = false;
                this.backImages = [];
              }
            });
          } else {
            // 编辑
            if (this.formRequired.zmcl && this.$refs.supportingMaterialRef.formFile.length > 0) {
              let zmcl = [];
              for (let i = 0; i < this.$refs.supportingMaterialRef.formFile.length; i++) {
                let file = this.$refs.supportingMaterialRef.formFile[i];
                if (file.type) {
                  console.log('文件类型', file);
                  // region TODO 上传证明材料
                  const formData = new FormData();
                  formData.append('file', file);
                  const uploadResponse = await imageUploadDataApi(formData);
                  if (uploadResponse.code == 200) {
                    this.$refs.supportingMaterialRef.formFile[i] = uploadResponse.result;
                  }
                }
              }
              zmcl = this.$refs.supportingMaterialRef.formFile;
              // region TODO 上传证明材料
              saveOrUpdate({...this.form, type: this.employmentCategory, zmcl: zmcl}).then(res => {
                this.submitLoading = false;
                if (res.success) {
                  this.$Message.success('操作成功');
                  this.getDataList();
                  this.modalVisible = false;
                  this.backImages = [];
                }
              });
            } else {
              saveOrUpdate({...this.form, type: this.employmentCategory}).then(res => {
                this.submitLoading = false;
                if (res.success) {
                  this.$Message.success('操作成功');
                  this.getDataList();
                  this.modalVisible = false;
                  this.backImages = [];
                }
              });
            }
          }
        }
      });
    },
    add() {
      this.modalType = 0;
      this.modalTitle = '添加';
      this.$refs.form.resetFields();
      delete this.form.id;
      this.modalVisible = true;
    },
    sjclaib(row) {
      this.$router.push({name: 'JyqxManageEdit', params: {row: row}, query: {type: '0'}});
      // this.backImages=[];
      // this.showRight = true;
      // this.modalType = 1;
      // this.modalTitle = '编辑区';
      // this.$refs.form.resetFields();
      // // 转换null为""
      // for (let attr in v) {
      //     if (v[attr] === null) {
      //         v[attr] = '';
      //     }
      // }
      // let str = JSON.stringify(v);
      // let data = JSON.parse(str);
      // if(data.onetype=="5"){
      //     data.onetype=""
      //     this.isSubmit=false
      // }else{
      //     this.isSubmit=true
      // }
      // // data={...data,dwszd:data.dwszd1}
      // let zmcl = data.zmcl;
      // console.log(zmcl, 'this.form.zmcl');
      // updateVal(this.form, data);
      // this.employmentCategory=this.form.type;
      // // this.form.dwszd = data.dwszd.split(/,/) || [];
      // if(data.dwszd){
      //     if (data.dwszd.indexOf(',') != -1) {
      //         let dwszd = data.dwszd.split(',') || '';
      //         this.form.dwszd = [];
      //         for (let item of dwszd) {
      //             console.log(item);
      //             this.form.dwszd.push(parseInt(item));
      //         }
      //     } else {
      //         this.form.dwszd = [];
      //         this.form.dwszd.push(parseInt(data.dwszd));
      //     }
      // }
      // console.log(this.form, 'this.form');
      // this.backImages = this.form.zmcl;
      // this.getByQxs(this.form.onetype);
      // try {
      //     if (this.form.zmcl) {
      //         this.form.zmcl = JSON.parse(crypto.decrypt(this.form.zmcl));
      //     }
      // } catch (e) {}
      // this.modalVisible = true;
    },
    edit(v) {
      this.backImages = [];
      this.modalType = 1;
      this.modalTitle = '编辑区';
      this.$refs.form.resetFields();
      // 转换null为""
      for (let attr in v) {
        if (v[attr] === null) {
          v[attr] = '';
        }
      }
      let str = JSON.stringify(v);
      let data = JSON.parse(str);
      if (data.onetype == '5') {
        data.onetype = '';
        this.isSubmit = false;
      } else {
        this.isSubmit = true;
      }
      // data={...data,dwszd:data.dwszd1}
      updateVal(this.form, data);
      this.employmentCategory = this.form.type;
      if (data.dwszd.indexOf(',') != -1) {
        let dwszd = data.dwszd.split(',') || '';
        this.form.dwszd = [];
        for (let item of dwszd) {
          this.form.dwszd.push(parseInt(item));
        }
      } else {
        this.form.dwszd = [];
        this.form.dwszd.push(parseInt(data.dwszd));
      } ;
      this.backImages = this.form.zmcl;
      this.getByQxs(data.onetype);
      if (this.form.zmcl) {
        this.form.zmcl = JSON.parse(crypto.decrypt(this.form.zmcl));
        this.$refs.upload.setData();
        this.$refs.upload.setData(this.form.zmcl);
      }

      this.modalVisible = true;
    },
    remove(v) {
      this.$Modal.confirm({
        title: '确认删除',
        // 记得确认修改此处
        content: '您确认要删除该条数据?',
        loading: true,
        onOk: () => {
          // 删除
          deleteJyqxInfo({ids: v.id}).then(res => {
            this.$Modal.remove();
            if (res.code == 200) {
              this.$Message.success('操作成功');
              this.clearSelectAll();
              this.getDataList();
            }
          });
        }
      });
    },
    delAll() {
      if (this.selectList.length <= 0) {
        this.$Message.warning('您还未选择要删除的数据');
        return;
      }
      this.$Modal.confirm({
        title: '确认删除',
        content: '您确认要删除所选的 ' + this.selectList.length + ' 条数据?',
        loading: true,
        onOk: () => {
          let ids = '';
          this.selectList.forEach(function (e) {
            ids += e.id + ',';
          });
          ids = ids.substring(0, ids.length - 1);
          // 批量删除
          deleteJyqxInfo({ids: ids}).then(res => {
            this.$Modal.remove();
            if (res.success) {
              this.$Message.success('操作成功');
              this.clearSelectAll();
              this.getDataList();
            }
          });
        }
      });
    },
    onRestWindow() {
        this.columns = this.restTableCellWidth(this.columns_1)
        this.quryLabelWidth = this.searchLabelWidth(this.quryLabelWidth)
        // this.addOrEditLabelWidth = this.searchLabelWidth(100)
    }
  },
  created() {

  },
  async mounted() {
    this.getareaData()
    if (this.$route.query.status > -1){
      this.searchForm.status = Number(this.$route.query.status)
    }else {
      this.searchForm.status  = ''
    }
    this.onRestWindow()
    window.addEventListener('resize',this.onRestWindow)

    let resource = JSON.parse(Cookies.get('userInfo')).resource;
    this.resource = resource;
    this.init();
    this.getEmploymentCategory();

    await this.handleSearch()
  },
  beforeDestroy() {
    window.removeEventListener('resize',this.onRestWindow)
  },

  beforeRouteEnter(to, from, next) {
    let  status  =  ''
    if (to.query.status > -1){
      status  = Number(to.query.status)
    }else {
      status  = ''
    }
    next(vm => {
      if (status >-1){
        vm.setStatus(status)
      }else {

      }
      // 如果用户是通过后退按钮返回到这个页面
      if (from.name === 'forwardName') {
        // 不刷新数据
      } else {
        // 重新获取数据
        vm.handleSearch()
      }
    });
  }
};
</script>

<style lang="less" scoped>

//form表单间距统一修改
.ivu-form-item {
  margin-bottom: 0.01rem !important;
}

.w_22-12 {
  width: calc(22% - 12px);
}

.card {
  background: white;
  transition: box-shadow .3s ease, transform .2s ease;
}

.card:hover {
  box-shadow: 0 4px 8px #23232333;
}

.el-select-dropdown li.el-select-dropdown-menu__item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w200 {
  width: 160px;
}
.ml-35 {
  margin-left: -35px;
}
.mr20 {
  margin-right: 20px
}
.class01 {
  color: #f56c6c; margin-left: 8px
}

@media (max-width: 1920px) {
    /deep/ .ivu-table .ivu-table-fixed-right {
        height: 98% !important;
        
    }
    /deep/ .ivu-table .ivu-table-fixed-body {
        height: 94% !important;
    }
    /deep/ .ivu-table-body {
        height: 94.2%!important;
    }
}

// 重构样式
/deep/ .ivu-form-item-label{
    display: flex;
    justify-content: right;
    width: 150px !important;
}
/deep/ .ivu-form-item {
    width: 100%;
    margin-bottom: 0.1rem;
    margin-right: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/deep/ .ivu-form-item-content {
    width: 100% !important;
    margin-left: 0 ! important;
}
/deep/ .ivu-select {
    width: 100% !important;
}
/deep/ .ivu-date-picker {
    width: 100% !important;
}
/deep/ .br {
    margin-top: 15px;
    bottom: 0.12rem !important;
    .ivu-form-item-content {
        display: flex;
    }
}
/deep/ .ivu-input-type-textarea,/deep/ .ivu-input {
    height: calc(100% - 7px) !important;
}
.flex-1 {
    height: 100%;
}
/deep/ .ivu-drawer-body {
    overflow: hidden;
    .d-flex-align-center {
        height: fit-content !important;
        margin-left: 0 !important;
        justify-content: right;
        box-sizing: border-box;
        padding-right: 7px;
    }
}
.box-key {
    /deep/ .ivu-form-item-content {
        margin-left: 100px !important;
    }
}
</style>
